package com.qyhl.webtv.module_news.news.collect;

import com.qyhl.webtv.commonlib.entity.news.NewsBean;

import java.util.List;

/**
 * Created by qyhl on 2017/12/5.
 */

public class CollectPresenter implements CollectContract.CollectPresenter {
    private CollectActivity mView;

    private CollectModel mModel;

    public CollectPresenter(CollectActivity mView) {
        this.mView = mView;
        this.mModel = new CollectModel(this);
    }

    @Override
    public void getData(String id) {
        mModel.getData(id);
    }

    @Override
    public void setDatas(List<NewsBean> beanList, boolean isMore) {
        mView.setDatas(beanList, isMore);
    }

    @Override
    public void setError(int code, String msg) {
        switch (code) {
            case 0:
                mView.setNetError(msg);
                break;
            case 1:
                mView.showMessage(msg);
                break;
            case 2:
                mView.setEmpty(msg);
                break;
            case 3:
                mView.setLog(msg);
                break;
            case 4:
                mView.setError(msg);
                break;
            case 5:
                mView.showMessage(msg);
                break;
            default:
                break;
        }
    }

    @Override
    public void cancelCollect(String newsId) {
        mModel.cancelCollect(newsId);
    }

    @Override
    public void cancelCollectSuccess() {
         mView.cancelCollectSuccess();
    }

    @Override
    public void cancelCollectError(String msg) {
       mView.cancelCollectError(msg);
    }

    @Override
    public void cancelCollect() {

    }
}
